﻿
/*----------------------------------------------------------------//
// 文件名：MoEmployee.cs
// 文件功能描述：实体 MoEmployee.
// 
// 创建标识：2009-02-27
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoEmployee
using System;
using System.Data;
using System.Globalization;
using System.Text;
using System.Xml;
using System.Data.Common;
namespace EQT.Model
{
	/// <summary>
	/// 业务实体MoEmployee
	/// </summary>
	public partial class MoEmployee:ICloneable
	{
		#region 表Employee的字段
		private string _emp_id;
		private string _dept_id;
		private string _fullname;
		private string _sex_code;
		private string _idcard;
		private DateTime _birthday;
		private string _phone;
		private string _home_addr;
		private string _rem;
		#endregion
		
		#region 构造函数
		public MoEmployee()
		{
		    
		    
		    
		    
		    
		    _birthday= DateTime.Now;
		    
		    
		    
		}
		#endregion
		
		#region 拷贝构造函数

		public MoEmployee(MoEmployee item)
		{
			item.CopyTo(this);
		}
		#endregion
		
		#region 带参数构造函数
	    public MoEmployee(string emp_id,string dept_id,string fullname,string sex_code,string idcard,DateTime birthday,string phone,string home_addr,string rem)
		{
		this._emp_id=emp_id;
		this._dept_id=dept_id;
		this._fullname=fullname;
		this._sex_code=sex_code;
		this._idcard=idcard;
		this._birthday=birthday;
		this._phone=phone;
		this._home_addr=home_addr;
		this._rem=rem;
		}
		#endregion
		
		#region 表Employee的字段属性
		/// <summary>
		///人员序号是自增序列。人员编码使用触发器实现。E0001,E0002
		/// </summary>
		public string Emp_Id
		{
			get {return _emp_id;}
			set {_emp_id=value;}
		}
		/// <summary>
		/// DEPT_ID
		/// </summary>
		public string Dept_Id
		{
			get {return _dept_id;}
			set {_dept_id=value;}
		}
		/// <summary>
		/// FULLNAME
		/// </summary>
		public string Fullname
		{
			get {return _fullname;}
			set {_fullname=value;}
		}
		/// <summary>
		/// SEX_CODE
		/// </summary>
		public string Sex_Code
		{
			get {return _sex_code;}
			set {_sex_code=value;}
		}
		/// <summary>
		/// IDCARD
		/// </summary>
		public string Idcard
		{
			get {return _idcard;}
			set {_idcard=value;}
		}
		/// <summary>
		/// BIRTHDAY
		/// </summary>
		public DateTime Birthday
		{
			get {return _birthday;}
			set {_birthday=value;}
		}
		/// <summary>
		/// PHONE
		/// </summary>
		public string Phone
		{
			get {return _phone;}
			set {_phone=value;}
		}
		/// <summary>
		/// HOME_ADDR
		/// </summary>
		public string Home_Addr
		{
			get {return _home_addr;}
			set {_home_addr=value;}
		}
		/// <summary>
		/// REM
		/// </summary>
		public string Rem
		{
			get {return _rem;}
			set {_rem=value;}
		}
		#endregion
		
		#region 辅助函数
		/// <summary>
		/// 拷贝函数
		/// </summary>
		public MoEmployee CopyTo(MoEmployee item)
        {
		    item.Emp_Id=this.Emp_Id;
		    item.Dept_Id=this.Dept_Id;
		    item.Fullname=this.Fullname;
		    item.Sex_Code=this.Sex_Code;
		    item.Idcard=this.Idcard;
		    item.Birthday=this.Birthday;
		    item.Phone=this.Phone;
		    item.Home_Addr=this.Home_Addr;
		    item.Rem=this.Rem;
			return item;
        }
		/// <summary>
		/// 克隆函数
		/// </summary>		
		public object Clone()
        {
            MoEmployee NewEmployee=new MoEmployee();
		    NewEmployee._emp_id=this._emp_id;
		    NewEmployee._dept_id=this._dept_id;
		    NewEmployee._fullname=this._fullname;
		    NewEmployee._sex_code=this._sex_code;
		    NewEmployee._idcard=this._idcard;
		    NewEmployee._birthday=this._birthday;
		    NewEmployee._phone=this._phone;
		    NewEmployee._home_addr=this._home_addr;
		    NewEmployee._rem=this._rem;
			return NewEmployee;
		}
		
		private static MoEmployee _empty = new MoEmployee(string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,DateTime.MinValue,string.Empty,string.Empty,string.Empty);
        public static MoEmployee Empty
        {
            get
            {
                return _empty;
            }
        }
		
		///<summary>
		///判断对象是否相等
		///<summary>
		public override bool Equals(object obj)
        {
            if (base.Equals(obj))
            {
                return true;
            }
            else
            {
                MoEmployee NewEmployee = obj as MoEmployee;
                if (NewEmployee == null)
                {
                    return false;
                }
                else
                {
				if (NewEmployee.Emp_Id==this.Emp_Id && NewEmployee.Dept_Id==this.Dept_Id && NewEmployee.Fullname==this.Fullname && NewEmployee.Sex_Code==this.Sex_Code && NewEmployee.Idcard==this.Idcard && NewEmployee.Birthday==this.Birthday && NewEmployee.Phone==this.Phone && NewEmployee.Home_Addr==this.Home_Addr && NewEmployee.Rem==this.Rem)		
					{
                        return true; 
                    }
                }

            }
            return false;
            
        }
		///TODO:you should modify GetHashCode by yourself.
		public override int GetHashCode()
		{
			return base.GetHashCode();
		} 

		public override string ToString()
        {
		   return String.Format("Emp_Id={0}/Dept_Id={1}/Fullname={2}/Sex_Code={3}/Idcard={4}/Birthday={5}/Phone={6}/Home_Addr={7}/Rem={8}",_emp_id,_dept_id,_fullname,_sex_code,_idcard,_birthday,_phone,_home_addr,_rem);
		 
		}
		#endregion
		
		#region DataTable Help Function
		///<summary>
		///DataRow转换成Model
		///</summary>
		public void Row2Model(DataRow row)
		{
		    if(row["Emp_ID"]!=null && row["Emp_ID"]!=DBNull.Value)
			{
			    this.Emp_Id = (string)row["Emp_ID"];
			}
			else
			{
				this.Emp_Id =string.Empty;
			}
		    if(row["Dept_ID"]!=null && row["Dept_ID"]!=DBNull.Value)
			{
			    this.Dept_Id = (string)row["Dept_ID"];
			}
			else
			{
				this.Dept_Id =string.Empty;
			}
		    if(row["FullName"]!=null && row["FullName"]!=DBNull.Value)
			{
			    this.Fullname = (string)row["FullName"];
			}
			else
			{
				this.Fullname =string.Empty;
			}
		    if(row["Sex_Code"]!=null && row["Sex_Code"]!=DBNull.Value)
			{
			    this.Sex_Code = (string)row["Sex_Code"];
			}
			else
			{
				this.Sex_Code =string.Empty;
			}
		    if(row["IDCard"]!=null && row["IDCard"]!=DBNull.Value)
			{
			    this.Idcard = (string)row["IDCard"];
			}
			else
			{
				this.Idcard =string.Empty;
			}
		    if(row["BirthDay"]!=null && row["BirthDay"]!=DBNull.Value)
			{
			    this.Birthday = (DateTime)row["BirthDay"];
			}
			else
			{
				this.Birthday =DateTime.MinValue;
			}
		    if(row["Phone"]!=null && row["Phone"]!=DBNull.Value)
			{
			    this.Phone = (string)row["Phone"];
			}
			else
			{
				this.Phone =string.Empty;
			}
		    if(row["Home_Addr"]!=null && row["Home_Addr"]!=DBNull.Value)
			{
			    this.Home_Addr = (string)row["Home_Addr"];
			}
			else
			{
				this.Home_Addr =string.Empty;
			}
		    if(row["Rem"]!=null && row["Rem"]!=DBNull.Value)
			{
			    this.Rem = (string)row["Rem"];
			}
			else
			{
				this.Rem =string.Empty;
			}
		}
		
		///<summary>
		///Model转换成DataRow
		///</summary>
	　　public void Model2Row(DataRow row)
		{
			row["Emp_ID"] = this.Emp_Id;
			row["Dept_ID"] = this.Dept_Id;
			row["FullName"] = this.Fullname;
			row["Sex_Code"] = this.Sex_Code;
			row["IDCard"] = this.Idcard;
			row["BirthDay"] = this.Birthday;
			row["Phone"] = this.Phone;
			row["Home_Addr"] = this.Home_Addr;
			row["Rem"] = this.Rem;
		}
		#endregion
	}
}
#endregion
